# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libgcrypt
pkgver=1.10.1
pkgrel=0
pkgdesc="General purpose crypto library based on the code used in GnuPG"
url="https://www.gnupg.org/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="libgpg-error-dev texinfo"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-$pkgver.tar.bz2"

# secfixes:
#   1.9.4-r0:
#     - CVE-2021-33560
#   1.8.5-r0:
#     - CVE-2019-13627
#   1.8.4-r2:
#     - CVE-2019-12904
#   1.8.3-r0:
#     - CVE-2018-0495

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-static
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -f $pkgdir/usr/share/info/dir
}

dev() {
	default_dev

	amove usr/bin/*
}

sha512sums="
e5ca7966624fff16c3013795836a2c4377f0193dbb4ac5ad2b79654b1fa8992e17d83816569a402212dc8367a7980d4141f5d6ac282bae6b9f02186365b61f13  libgcrypt-1.10.1.tar.bz2
"
